package org.testfire.translator.watij.assertions;

import org.testfire.model.assertions.AssertDoubleEquals;
import org.testfire.model.TestsetType;
import org.testfire.translator.TestFireTranslator;
import org.testfire.translator.TranslatorFactory;

/**
 * Created by IntelliJ IDEA.
 * User: granum
 * Date: Sep 2, 2007
 * Time: 5:49:04 PM
 *
 */
public class AssertDoubleEqualsTranslator<T> implements TestFireTranslator<AssertDoubleEquals>
{

    public Object translate( TestsetType testset, AssertDoubleEquals type )
    {
        StringBuilder buf = new StringBuilder();
        String act = TranslatorFactory.translate( testset, type.getFinder() ).toString();
        buf.append(
            String.format( "assertEquals( \"%1$s\", %2$s, %3$s, %4$s )", type.getMessage(), type.getExpected(), act,
                type.getDelta() ) );
        return buf.toString();
    }
}